import TextArea from "antd/es/input/TextArea"
import { FC } from "react"

import { SFormItem } from "@/components/common"
import { useLocale } from "@/locales"

const TextAreaInput: FC<any> = props => {
	const { fieldName, labelProps, textareaProps, rules, required = false } = props
	const { formatMessage } = useLocale()
	return (
		<SFormItem name={fieldName} label={formatMessage({ id: labelProps.label })} rules={rules} {...labelProps} required={required}>
			<TextArea
				count={{
					show: true,
					max: textareaProps.maxLength
				}}
				{...textareaProps}
			/>
		</SFormItem>
	)
}

export default TextAreaInput
